window.onload = function() {
	//banner
	var i = $(window).width();
	if(i == 1900 ||　i>1900){
		$(".loan_kuang").css('left','-17%');
	}else{
		$(".loan_kuang").css('left','-24%');
	}
	var fc = getRadioValue('home');
	if(fc == '有'){
		$(".fczk").css('display','block');
	}
	var bd = getRadioValue('bao');
	if(bd == '有'){
		$(".bdzk").css('display','block');
	}
	var jobid = $('#jobid').val();
	if(jobid == 1){
		$('.zylx1').css('display','block');
		$('.zylx2').css('display','none');
		$('.zylx3').css('display','none');
		$('.zhuce').css('display','none');
		$('.jingying').css('display','none');
	}else if(jobid == 2){
		var company_card_have = getRadioValue("company_card_have");
		if(company_card_have == '有'){
			$('.zhuce').css('display','block');
		}else if(company_card_have == '无'){
			$('.jingying').css('display','block');
		}
		$('.zylx1').css('display','none');
		$('.zylx2').css('display','block');
		$('.zylx3').css('display','none');
	}else if(jobid == 3){
		$('.zylx1').css('display','none');
		$('.zylx2').css('display','none');
		$('.zylx3').css('display','block');
		$('.zhuce').css('display','none');
		$('.jingying').css('display','none');
	}
}
function details(){
	var det1 = document.getElementById("det1");
	var det2 = document.getElementById("det2");	
	det1.style.display = (det1.style.display == 'block')?'none':'block';
	det2.style.display = (det2.style.display == 'none')?'block':'none';
}
$(function(){
	$('.ui-select').click(function(){
		$('.select-list').css('display','none');
		$(this).children('.select-list').css('display','block');
		return false;
	});
	$(".seltf").click(function(){
		var val = $(this).html();
		var sel = $('.self').html(val);
		var ins = document.getElementById("inself");
		var id = $(this).attr('data-val');
		sel.innerHTML = val;
		ins.value = id;
		$(this).parent('.select-list').css('display','none');
		return false;
		
	});
	$(".selts").click(function(){
		var val = $(this).html();
		var sel = $('.sels').html(val);
		var ins = document.getElementById("insels");
		var id = $(this).attr('data-val');
		sel.innerHTML = val;
		ins.value = id;
		$(this).parent('.select-list').css('display','none');
		return false;
		
	});
	$(".seltt").click(function(){
		var val = $(this).html();
		var sel = $('.selt').html(val);
		var id = $(this).attr('data-val');
		var ins = document.getElementById("inselt");
		sel.innerHTML = val;
		ins.value = id;
		$(this).parent('.select-list').css('display','none');
		return false;
	});
	
	$("body").click(function(){
		$('.select-list').css('display','none');
	});
	
	$("#fkremark").focus(function(){
		$(".nrww").css('border','1px solid #f9322e');
	});
	$("#fkremark").blur(function(){
		$(".nrww").css('border','1px solid #e5e5e5');
	});
	$("#lxfs").focus(function(){
		$(".lxww").css('border','1px solid #f9322e');
	});
	$("#lxfs").blur(function(){
		$(".lxww").css('border','1px solid #e5e5e5');
	});
});
$(window).scroll(function () {
	var mainCol = window.document.getElementById('footer_wrap');
	var i = mainCol.offsetHeight;
	var hCol = window.document.getElementById('header');
	var j = hCol.offsetHeight;
	var viewheight = $(window).height();
	var contheight = $(document).height();
	var scroll = $(document).scrollTop();
	if (scroll + viewheight >= contheight - i) {
		$(".tktb").css('bottom','36%');
	}else if (scroll < j) {
		$(".tktb").css('bottom','3%');
	}else{
		$(".tktb").css('bottom','18%');
	}
});
function zizhi(){
	$("#zhuantai").css('display','block');
	$(".xuanxiang").click(function(){
		var id = $(this).attr('value');
		var ins = document.getElementById("zzbh");
		ins.value = id;
		$("#zhuantai").css('display','none');
	});
}
function zysf(){
	var fc = getRadioValue('home');
	if(fc == '有'){
		$(".fczk").css('display','block');
	}
	var bd = getRadioValue('bao');
	if(bd == '有'){
		$(".bdzk").css('display','block');
	}
	var jobid = $('#jobid').val();
	if(jobid == 1){
		$('.zylx1').css('display','block');
		$('.zylx2').css('display','none');
		$('.zylx3').css('display','none');
		$('.zhuce').css('display','none');
		$('.jingying').css('display','none');
	}else if(jobid == 2){
		var company_card_have = getRadioValue("company_card_have");
		if(company_card_have == '有'){
			$('.zhuce').css('display','block');
		}else if(company_card_have == '无'){
			$('.jingying').css('display','block');
		}
		$('.zylx1').css('display','none');
		$('.zylx2').css('display','block');
		$('.zylx3').css('display','none');
	}else if(jobid == 3){
		$('.zylx1').css('display','none');
		$('.zylx2').css('display','none');
		$('.zylx3').css('display','block');
		$('.zhuce').css('display','none');
		$('.jingying').css('display','none');
	}
}
function xzsex(){
	$('.sexxx').css('display','block');
	$('.sex').click(function(){
		var xz = $(this).html();
		var inssex = document.getElementById('inssex');
		$('.showsex').empty().append(xz);
		inssex.value = xz;
		$('.sexxx').css('display','none');
	});
}
function getRadioValue(radioName) {
    var chkRadio = document.getElementsByName(radioName);
    for (var i = 0; i < chkRadio.length; i++) {
        if (chkRadio[i].checked)
            return chkRadio[i].value;
    }
}
//反馈弹框
function fk(){
	$(".tknr").css('display','block');
	$(".tktb").css('display','none');
}
function closefk(){
	$(".tknr").css('display','none');
	$(".tktb").css('display','block');
	document.getElementById("fkremark").value = '';
	document.getElementById("lxfs").value = '';
}
function fankui_new()
{
	var fkremark = document.getElementById("fkremark_new").value;
	var uid = document.getElementById("uid_new").value;
	var mobile = document.getElementById("lxfs_new").value;
	if(fkremark == ''){
		alert("请填写反馈内容！");
	}else if(mobile == '联系方式' || mobile == ''){
		alert("请填写联系方式或登录后再进行操作！");
	}else{
		var json_data = {'fkremark':fkremark,'uid':uid,'mobile':mobile};
		$.ajax({
		    type: 'GET',  //这里用GET
		    url: jiekou_site_url+'/user/feedback.html',
		    dataType: 'jsonp',  //类型
		    data: json_data,
		    jsonp: 'jcallback', //jsonp回调参数，必需
		    async: false,
		    success: function(d) { //返回的json数据
				$('.subm').val('提交中...');
				$('.subm').attr("disabled","disabled");
				if(d == 0){
					alert("反馈失败！");
					$('.subm').val('提交');
					$('.subm').removeAttr("disabled"); 
				}else if(d == 1){
					alert("感谢您宝贵的意见！");
					$(".feedback").css('display','none');
					$('.subm').val('提交');
					$('.subm').removeAttr("disabled"); 
				}else if(d == 2){
					alert("请勿提交重复的数据,谢谢合作！");
					$('.subm').val('提交');
					$('.subm').removeAttr("disabled"); 
				}
		    },
		    timeout: 3000
		});
	}
	document.getElementById("fkremark_new").value = '';
	document.getElementById("lxfs").value = '';
	document.getElementById("count").innerHTML = 200;
}
function checkLen(obj) 
{
	var maxChars = 200;//最多字符数
	if (obj.value.length > maxChars){
		obj.value = obj.value.substring(0,maxChars);
		alert("您最多只能输入两百字！");
	}
	var curr = maxChars - obj.value.length;
	document.getElementById("count").innerHTML = curr.toString();
}

//登录方式
function mmdl(){
	$('.mm').css('color','#828283');
	$('.yz').css('color','#2d5dc3');
	$('.mmdl').css('display','block');
	$('.yzdl').css('display','none');
	document.getElementById("yzm").value="";
	document.getElementById("dlfs").value="1"; 
}
function yzdl(){
	$('.mm').css('color','#2d5dc3');
	$('.yz').css('color','#828283');
	$('.mmdl').css('display','none');
	$('.yzdl').css('display','block');
	document.getElementById("password").value="";
	document.getElementById("dlfs").value="2"; 
}
